package factory.abstractFactory;

import factory.abstractFactory.actual.factory.FactoryProducer;
import factory.abstractFactory.actual.factory.PenFactory;
import factory.abstractFactory.constant.FactoryType;
import factory.abstractFactory.virtual.factory.BaseFactory;
import factory.abstractFactory.virtual.product.Product;
import factory.abstractFactory.virtual.product.Rubbish;

/**
 * @author 若雨成霜
 * 抽象工厂模式
 */

public class TestAbstractFactory {
    public static void main(String[] args) {
        BaseFactory baseFactory = FactoryProducer.getBaseFactory(FactoryType.PEN);
        assert baseFactory != null;
        Product product = baseFactory.produce();
        product.doSomething();
        Rubbish rubbish = baseFactory.destroy();
        rubbish.destroy();
    }
}
